﻿using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Handrise.CDCable.Mobile.Business;

namespace Handrise.CDCable.Mobile.UI
{
    public partial class FrmEquipLst :FrmBase
    {
        private string parentForm = "";
        private object parentInfo;
        private EquipmentTypeService equipmentTypeService = new EquipmentTypeService();
         
        public FrmEquipLst()
        {
            InitializeComponent();
            ttlbrhead.Text = "设备类型选择";
            ilstbcdown.Images.Add(ResourceImage.空白);
            ilstbcdown.Images.Add(ResourceImage.空白);
            ilstbcdown.Images.Add(ResourceImage.返回02);
            ilstbcup.Images.Add(ResourceImage.空白);
            ilstbcup.Images.Add(ResourceImage.空白);
            ilstbcup.Images.Add(ResourceImage.返回01);
            ibpageprev.UpImage = ResourceImage.上一页可点击;
            ibpageprev.DownImage = ResourceImage.上一页点击;
            ibpageprev.DisableImage = ResourceImage.上一页灰;
            ibpagenext.UpImage = ResourceImage.下一页可点击;
            ibpagenext.DownImage = ResourceImage.下一页点击;
            ibpagenext.DisableImage = ResourceImage.下一页灰;
        }

        private void FrmEquipLst_Load(object sender, EventArgs e)
        {
            LoadData();

            //获取所有设备类型
            List<EquipmentType> equipmentTypes = equipmentTypeService.GetAllEquipmentType() ;
            dlEquipmentType.DataSource = equipmentTypes;
            dlEquipmentType.DisplayMember = "FTYPENAME";
            dlEquipmentType.DataBind();
        }

        /// <summary>
        /// 加载数据
        /// </summary>
        private void LoadData()
        {
            parentForm = (string)Parameter[0];
            parentInfo = Parameter[1];
        }

        private void bcxunjian_OnButtonClick(object sender, int buttonIndex)
        {
            switch (buttonIndex)
            {
                case 2:
                    FormManage.GotoNext(parentForm,null, null, true);
                    break;

            }
        }

        private void dlEquipmentType_OnItemClick(HandRise.MBHOP.Controls.DataListItem item)
        {
            EquipmentType equipmentType = (EquipmentType)item.DataSource;
            FormManage.GotoNext(parentForm, new object[] { equipmentType.FTYPENAME, parentInfo }, null, false);
        }

        private void ibpageprev_Click(object sender, EventArgs e)
        {
            dlEquipmentType.PreviousPage();
        }

        private void ibpagenext_Click(object sender, EventArgs e)
        {
            dlEquipmentType.NextPage();
        }



    }
}